<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>object</title>
</head>
<body>
    <script type="text/javascript">
        var name = 'fireleg';
        function laohu(){
            alert(name);
        }
        function qie(){
            alert(name);
        }
        laohu();
        // 对象  字面量创建 姓名,年龄,性别,爱好(动作)
        var person = {
            name: 'mjj',
            age: 18,
            sex:'女',
            fav: function(a) {
                alert('male');
                return 'male' + a + '岁';
            }
        }
        console.log(person);
        console.log(person.name);
        console.log(person.fav(18));
    </script>

</body>
</html>